package io.tim.webserver.simple02.util;

/**
 * 定义不同扩展名对应的 MIME TYPE
 * 
 * @author Zhang Nan
 * @since [28/02/2017]
 *
 */
public enum MimeEnumInfo {
	ASX("asx", "video/x-ms-asf"),
	XML("xml", "text/xml"),
	TSV("tsv", "text/tab-separated-values"),
	RA("ra", "audio/x-pn-realaudio"),
	SV4CRC("sv4crc", "application/x-sv4crc"),
	SPC("spc", "application/x-pkcs7-certificates"),
	PMC("pmc", "application/x-perfmon"),
	LIT("lit", "application/x-ms-reader"),
	CRD("crd", "application/x-mscardfile"),
	ISP("isp", "application/x-internet-signup"),
	WMLSC("wmlsc", "application/vnd.wap.wmlscriptc"),
	VST("vst", "application/vnd.visio"),
	XLAM("xlam", "application/vnd.ms-excel.addin.macroEnabled.12"),
	TTF("ttf", "application/octet-stream"),
	PFM("pfm", "application/octet-stream"),
	CSV("csv", "application/octet-stream"),
	AAF("aaf", "application/octet-stream"),
	ONE("one", "application/onenote"),
	HTA("hta", "application/hta"),
	ATOM("atom", "application/atom+xml"),
	H323("323", "text/h323"),
	MHTML("mhtml", "message/rfc822"),
	MIDI("midi", "audio/mid"),
	P7R("p7r", "application/x-pkcs7-certreqresp"),
	MNY("mny", "application/x-msmoney"),
	CLP("clp", "application/x-msclip"),
	VSD("vsd", "application/vnd.visio"),
	LPK("lpk", "application/octet-stream"),
	BIN("bin", "application/octet-stream"),
	ONETOC("onetoc", "application/onenote"),
	X("x", "application/directx"),
	WVX("wvx", "video/x-ms-wvx"),
	VCF("vcf", "text/x-vcard"),
	HTC("htc", "text/x-component"),
	HTT("htt", "text/webviewhtml"),
	H("h", "text/plain"),
	MHT("mht", "message/rfc822"),
	MID("mid", "audio/mid"),
	P7B("p7b", "application/x-pkcs7-certificates"),
	GZ("gz", "application/x-gzip"),
	DVI("dvi", "application/x-dvi"),
	CPIO("cpio", "application/x-cpio"),
	VDX("vdx", "application/vnd.ms-visio.viewer"),
	SLDM("sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12"),
	XLM("xlm", "application/vnd.ms-excel"),
	FDF("fdf", "application/vnd.fdf"),
	SETREG("setreg", "application/set-registration-initiation"),
	EPS("eps", "application/postscript"),
	P7S("p7s", "application/pkcs7-signature"),
	TOC("toc", "application/octet-stream"),
	MDP("mdp", "application/octet-stream"),
	ICS("ics", "application/octet-stream"),
	CHM("chm", "application/octet-stream "),
	ASI("asi", "application/octet-stream"),
	AFM("afm", "application/octet-stream"),
	EVY("evy", "application/envoy"),
	WMP("wmp", "video/x-ms-wmp "),
	QT("qt", "video/quicktime"),
	MPV2("mpv2", "video/mpeg"),
	XSLT("xslt", "text/xml"),
	ETX("etx", "text/x-setext"),
	COD("cod", "image/cis-cod"),
	SND("snd", "audio/basic"),
	AU("au", "audio/basic"),
	MAN("man", "application/x-troff-man"),
	QTL("qtl", "application/x-quicktimeplayer"),
	PMW("pmw", "application/x-perfmon"),
	CLASS("class", "application/x-java-applet"),
	III("iii", "application/x-iphone"),
	CSH("csh", "application/x-csh"),
	Z("z", "application/x-compress"),
	VTX("vtx", "application/vnd.visio"),
	VSW("vsw", "application/vnd.visio"),
	WPS("wps", "application/vnd.ms-works"),
	POTX("potx", "application/vnd.openxmlformats-officedocument.presentationml.template"),
	PS("ps", "application/postscript"),
	P7C("p7c", "application/pkcs7-mime"),
	THN("thn", "application/octet-stream"),
	MSO("mso", "application/octet-stream"),
	DOT("dot", "application/msword"),
	DOC("doc", "application/msword"),
	SGML("sgml", "text/sgml"),
	NWS("nws", "message/rfc822"),
	PBM("pbm", "image/x-portable-bitmap "),
	IEF("ief", "image/ief"),
	WAV("wav", "audio/wav"),
	TEXI("texi", "application/x-texinfo"),
	MVB("mvb", "application/x-msmediaview"),
	HDF("hdf", "application/x-hdf"),
	VSX("vsx", "application/vnd.visio"),
	DOTM("dotm", "application/vnd.ms-word.template.macroEnabled.12"),
	DOCM("docm", "application/vnd.ms-word.document.macroEnabled.12"),
	PPTX("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation"),
	PSM("psm", "application/octet-stream"),
	JAVA("java", "application/octet-stream"),
	EOT("eot", "application/octet-stream"),
	JAR("jar", "application/java-archive"),
	MPEG("mpeg", "video/mpeg"),
	XSF("xsf", "text/xml"),
	MAP("map", "text/plain"),
	ULS("uls", "text/iuls"),
	RF("rf", "image/vnd.rn-realflash"),
	M3U("m3u", "audio/x-mpegurl"),
	WMA("wma", "audio/x-ms-wma"),
	AIFC("aifc", "audio/aiff"),
	MDB("mdb", "application/x-msaccess"),
	MVC("mvc", "application/x-miva-compiled"),
	STL("stl", "application/vnd.ms-pki.stl"),
	PPSX("ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow"),
	XLSB("xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12"),
	SETPAY("setpay", "application/set-payment-initiation"),
	PRM("prm", "application/octet-stream"),
	MIX("mix", "application/octet-stream"),
	LZH("lzh", "application/octet-stream"),
	HHK("hhk", "application/octet-stream"),
	ONEPKG("onepkg", "application/onenote"),
	XAF("xaf", "x-world/x-vrml"),
	FLR("flr", "x-world/x-vrml"),
	IVF("IVF", "video/x-ivf"),
	CNF("cnf", "text/plain"),
	ASM("asm", "text/plain"),
	TIFF("tiff", "image/tiff"),
	WAX("wax", "audio/x-ms-wax"),
	MS("ms", "application/x-troff-ms"),
	TCL("tcl", "application/x-tcl"),
	SHAR("shar", "application/x-shar"),
	SH("sh", "application/x-sh"),
	NC("nc", "application/x-netcdf"),
	HLP("hlp", "application/winhlp"),
	ODA("oda", "application/oda"),
	PFB("pfb", "application/octet-stream"),
	FLA("fla", "application/octet-stream"),
	WM("wm", "video/x-ms-wm"),
	RGB("rgb", "image/x-rgb"),
	PPM("ppm", "image/x-portable-pixmap"),
	RAM("ram", "audio/x-pn-realaudio"),
	SIT("sit", "application/x-stuffit"),
	DIR("dir", "application/x-director"),
	MPP("mpp", "application/vnd.ms-project"),
	XLA("xla", "application/vnd.ms-excel"),
	SSM("ssm", "application/streamingmedia "),
	AXS("axs", "application/olescript"),
	ODS("ods", "application/oleobject"),
	PSP("psp", "application/octet-stream"),
	JPB("jpb", "application/octet-stream"),
	WRZ("wrz", "x-world/x-vrml"),
	M1V("m1v", "video/mpeg"),
	MNO("mno", "text/xml"),
	CMX("cmx", "image/x-cmx"),
	JPEG("jpeg", "image/jpeg"),
	DIB("dib", "image/bmp"),
	RMI("rmi", "audio/mid"),
	AIFF("aiff", "audio/aiff"),
	WMD("wmd", "application/x-ms-wmd"),
	WRI("wri", "application/x-mswrite"),
	PUB("pub", "application/x-mspublisher"),
	INS("ins", "application/x-internet-signup"),
	WKS("wks", "application/vnd.ms-works"),
	XLS("xls", "application/vnd.ms-excel"),
	AI("ai", "application/postscript"),
	CRL("crl", "application/pkix-crl"),
	QXD("qxd", "application/octet-stream"),
	DWP("dwp", "application/octet-stream"),
	XOF("xof", "x-world/x-vrml"),
	WMV("wmv", "video/x-ms-wmv"),
	NSC("nsc", "video/x-ms-asf"),
	MPA("mpa", "video/mpeg"),
	PNM("pnm", "image/x-portable-anymap"),
	RPM("rpm", "audio/x-pn-realaudio-plugin"),
	AIF("aif", "audio/x-aiff"),
	ME("me", "application/x-troff-me"),
	PML("pml", "application/x-perfmon"),
	TRM("trm", "application/x-msterminal"),
	M13("m13", "application/x-msmediaview"),
	JS("js", "application/x-javascript"),
	DXR("dxr", "application/x-director"),
	POTM("potm", "application/vnd.ms-powerpoint.template.macroEnabled.12"),
	XLTX("xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template"),
	XLT("xlt", "application/vnd.ms-excel"),
	XLC("xlc", "application/vnd.ms-excel"),
	P10("p10", "application/pkcs10"),
	SMI("smi", "application/octet-stream"),
	SEA("sea", "application/octet-stream"),
	HQX("hqx", "application/mac-binhex40"),
	SPL("spl", "application/futuresplash"),
	MOVIE("movie", "video/x-sgi-movie"),
	LSF("lsf", "video/x-la-asf"),
	TXT("txt", "text/plain"),
	JFIF("jfif", "image/pjpeg"),
	JPE("jpe", "image/jpeg"),
	ZIP("zip", "application/x-zip-compressed"),
	WMF("wmf", "application/x-msmetafile"),
	M14("m14", "application/x-msmediaview"),
	LATEX("latex", "application/x-latex"),
	WCM("wcm", "application/vnd.ms-works"),
	PPTM("pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12 "),
	XLSX("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),
	HHP("hhp", "application/octet-stream"),
	ACA("aca", "application/octet-stream"),
	ACCDB("accdb", "application/msaccess"),
	JCZ("jcz", "application/liquidmotion"),
	WRL("wrl", "x-world/x-vrml"),
	WMX("wmx", "video/x-ms-wmx"),
	ASR("asr", "video/x-ms-asf"),
	LSX("lsx", "video/x-la-asf"),
	XSL("xsl", "text/xml"),
	HTML("html", "text/html"),
	TIF("tif", "image/tiff"),
	DER("der", "application/x-x509-ca-cert"),
	PFX("pfx", "application/x-pkcs12"),
	P12("p12", "application/x-pkcs12"),
	PPSM("ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),
	CUR("cur", "application/octet-stream"),
	ACCDT("accdt", "application/msaccess"),
	HDML("hdml", "text/x-hdml"),
	HTM("htm", "text/html"),
	XBM("xbm", "image/x-xbitmap"),
	JPG("jpg", "image/jpeg"),
	TEXINFO("texinfo", "application/x-texinfo"),
	PPAM("ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12"),
	XLW("xlw", "application/vnd.ms-excel"),
	RM("rm", "application/vnd.rn-realmedia"),
	PDF("pdf", "application/pdf"),
	RAR("rar", "application/octet-stream"),
	PSD("psd", "application/octet-stream"),
	INF("inf", "application/octet-stream"),
	EMZ("emz", "application/octet-stream"),
	DSP("dsp", "application/octet-stream"),
	ONEA("onea", "application/onenote"),
	JCK("jck", "application/liquidmotion"),
	MPE("mpe", "video/mpeg"),
	MP2("mp2", "video/mpeg"),
	SCT("sct", "text/scriptlet"),
	RAS("ras", "image/x-cmu-raster"),
	SWF("swf", "application/x-shockwave-flash "),
	FLV("FLV", "flv-application/octet-stream"),
	XPM("xpm", "image/x-xpixmap"),
	ICO("ico", "image/x-icon"),
	GIF("gif", "image/gif"),
	DWF("dwf", "drawing/x-dwf"),
	SRC("src", "application/x-wais-source"),
	TR("tr", "application/x-troff"),
	PMR("pmr", "application/x-perfmon"),
	PMA("pma", "application/x-perfmon"),
	DLL("dll", "application/x-msdownload"),
	BCPIO("bcpio", "application/x-bcpio"),
	WMLC("wmlc", "application/vnd.wap.wmlc"),
	WDB("wdb", "application/vnd.ms-works"),
	DOTX("dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template"),
	DOCX("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"),
	POT("pot", "application/vnd.ms-powerpoint"),
	XLTM("xltm", "application/vnd.ms-excel.template.macroEnabled.12"),
	RTF("rtf", "application/rtf"),
	PRF("prf", "application/pics-rules"),
	SNP("snp", "application/octet-stream"),
	CAB("cab", "application/octet-stream"),
	AVI("avi", "video/x-msvideo"),
	ASF("asf", "video/x-ms-asf"),
	DTD("dtd", "text/xml"),
	WML("wml", "text/vnd.wap.wml"),
	VBS("vbs", "text/vbscript"),
	RTX("rtx", "text/richtext"),
	DLM("dlm", "text/dlm"),
	XWD("xwd", "image/x-xwindowdump "),
	PGM("pgm", "image/x-portable-graymap"),
	BMP("bmp", "image/bmp"),
	CRT("crt", "application/x-x509-ca-cert"),
	USTAR("ustar", "application/x-ustar"),
	TEX("tex", "application/x-tex"),
	SV4CPIO("sv4cpio", "application/x-sv4cpio"),
	TGZ("tgz", "application/x-compressed"),
	CDF("cdf", "application/x-cdf"),
	VSS("vss", "application/vnd.visio"),
	CAT("cat", "application/vnd.ms-pki.seccat"),
	THMX("thmx", "application/vnd.ms-officetheme"),
	XLSM("xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12"),
	PRX("prx", "application/octet-stream"),
	PCZ("pcz", "application/octet-stream"),
	ONETMP("onetmp", "application/onenote"),
	ACX("acx", "application/internet-property-stream"),
	WSDL("wsdl", "text/xml"),
	DISCO("disco", "text/xml"),
	XSD("xsd", "text/xml"),
	WBMP("wbmp", "image/vnd.wap.wbmp"),
	PNG("png", "image/png"),
	PNZ("pnz", "image/png"),
	SMD("smd", "audio/x-smd"),
	SMZ("smz", "audio/x-smd"),
	SMX("smx", "audio/x-smd"),
	MMF("mmf", "application/x-smaf"),

	// 其他错误
	OTHER_EXT("other", "text/plain");

	private String code;
	private String message;

	private MimeEnumInfo(String code, String message) {
		this.code = code;
		this.message = message;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public static String getResponseMsg(String code) {
		for (MimeEnumInfo wrapperEnumInfo : MimeEnumInfo.values()) {
			if (code.equals(wrapperEnumInfo.getCode())) {
				return wrapperEnumInfo.getMessage();
			}
		}
		return OTHER_EXT.getMessage();
	}
}
